import { notFound } from "next/navigation"; import type { ReactNode } from "react"; import { api } from "@/lib/api"; /** Existence check outside the loading boundary so unknown keys return a real 404 (the fetch is cached for the page). */ export default async function RankingLayout({ children, params }: { children: ReactNode; params: Promise<{ key: string }> }) { const { key } = await params; const r = await api.ranking(key, { limit: 200 }); if (!r.ok && (r.status === 404 || r.status === 400)) notFound(); return children; }